<template>
  <div class="upload">
    <upload-excel
      :beforeUpload="beforeUpload"
      :onSuccess="onSuccess"
    ></upload-excel>
  </div>
</template>

<script>
export default {
  data () {
    return {}
  },
  methods: {
    // 上传前
    beforeUpload (rawFile) {
      let _boolean = rawFile.size / 1024 / 1024 < 2
      if (!_boolean) {
        alert('上传文件大小不能超过2M')
      }
      return _boolean
    },
    // 上传成功后
    onSuccess (obj) {
      window.console.log(obj)
    }
  }
}
</script>

<style></style>
